import {useUserStore} from './modules/user'
import {useUserFriendStore} from "/@/store/modules/userFriend";
import {useWebSocketStore} from "/@/store/modules/websocketstore";

// import socketUtils from "/@/utils/websocket"
import {WebSocketReqMsgContentType, WebSocketRequestMsgType} from "/@/utils/types";
import {RoomTypeEnum} from "/@/utils/enum";
import {MessageQueryCriteria} from "/@/api/openapi";

const stationsStore = useUserStore();
const userFriendStore = useUserFriendStore();
const webSocketStore = useWebSocketStore();
// watch(() => stationsStore.isSign, (newValue, oldValue) => {
//     console.log('stationId 变化了:', oldValue, '->', newValue);
//     // 执行其他逻辑...
//     socketUtils.initConnect();
//     const hello: WebSocketReqMsgContentType = {
//         type: WebSocketRequestMsgType.RequestLoginQrCode,
//         data: {
//             "username": 1,
//         }
//     }
//     // 发送一个 hello 消息
//     // socketUtils.send(hello);
//
//     // 用户更新
//     userFriendStore.updateUserFriend();
//     userFriendStore.updateUserApply({pageSize: 10, pageNum: 1})
//     userFriendStore.updateAllUser({pageSize: 10, pageNum: 1})
//     userFriendStore.updateChatGroup()
//     userFriendStore.updateContact({pageSize: 100, pageNum: 1}).then(r => {
//         console.log("更新了updateContact" + r)
//         if (r > 0) {
//             // 默认选择第一个会话
//             if (userFriendStore.contact.size !== undefined && userFriendStore.contact.size > 0 && userFriendStore.contactList !== undefined) {
//                 // 说明成功更新了会话
//                 const contactVo = userFriendStore.contactList[0];
//                 if (contactVo.roomId !== undefined) {
//                     webSocketStore.currentRoomId = contactVo.roomId;
//                 }
//                 webSocketStore.currentContact = contactVo;
//
//             }
//         }
//     })
// });
//
// watch(() => webSocketStore.currentRoomId, (newValue, oldValue) => {
//     webSocketStore.updateCurrentRoomId(); // 当切换新的房间时。需要进行更新
// })
export {useUserStore, useUserFriendStore, useWebSocketStore}


